﻿<%@ Page Language="C#" MasterPageFile="~/Include/Admin.master" AutoEventWireup="true"
    CodeFile="Manage.aspx.cs" Inherits="Admin_Nava_Manage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <ajaxToolkit:ToolkitScriptManager runat="Server" EnableScriptGlobalization="true"
        EnableScriptLocalization="true" ID="ScriptManager1" />
    <div>
        <table cellpadding="0" cellspacing="0" style="width: 100%; background-color: #ccccff">
            <tr>
                <td style="padding: 5px; padding-right: 5px;" colspan="3">
                    <table cellspacing="0" cellpadding="0" style="width: 100%; padding-bottom: 5px; border: 1px;
                        border-color: #66CCFF;">
                        <tr style="background-image: url('../../images/title_bg1.jpg'); background-repeat: repeat-x;">
                            <td colspan="2" style="font-weight: bold; font-size: large; font-family: 仿宋; text-align: center"
                                class="style2">
                                <strong>购物类别管理</strong>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <asp:LinkButton ID="lbtnReturn" runat="server" OnClick="lbtnReturn_Click">返回上一层</asp:LinkButton>
                            </td>
                            <td align="center">
                            </td>
                        </tr>
                    </table>
                    <table cellspacing="0" cellpadding="0" style="width: 100%; padding-bottom: 5px; border: 1px;
                        border-color: #66CCFF; background-color: #ffffff">
                        <tr>
                            <td align="center">
                                <asp:ListView ID="lvNavagation" runat="server" DataKeyNames="ID" OnItemCanceling="lvNavagation_ItemCanceling"
                                    OnItemDeleting="lvNavagation_ItemDeleting" OnItemEditing="lvNavagation_ItemEditing"
                                    OnItemUpdating="lvNavagation_ItemUpdating" OnItemCommand="lvNavagation_ItemCommand">
                                    <LayoutTemplate>
                                        <table width="100%" class="editTable" cellspacing="1">
                                            <tr>
                                                <th>
                                                    分类ID
                                                </th>
                                                <th>
                                                    父分类标题
                                                </th>
                                                <th>
                                                    分类标题
                                                </th>
                                                <th>
                                                    分类图片
                                                </th>
                                                <th>
                                                    操作
                                                </th>
                                            </tr>
                                            <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                                        </table>
                                    </LayoutTemplate>
                                    <ItemTemplate>
                                        <tr>
                                            <td>
                                                <a href='?NavaParentID=<%#Eval("ID")%>'>
                                                    <%# Eval("ID")%></a>
                                            </td>
                                            <td>
                                                <asp:LinkButton ID="lbtnParentID" CommandArgument='<%#Eval("ParentID")%>' runat="server"
                                                    CommandName="Return"> <%#NavagationTitleByID(Eval("ParentID"))%></asp:LinkButton>
                                            </td>
                                            <td>
                                                <%# Eval("Title")%>
                                            </td>
                                            <td>
                                                <img width="20px" height="20px" alt='logo' src='/Resource/Nava/<%#Eval("ImgSrc")?? "no_image.jpg" %>' />
                                            </td>
                                            <td>
                                                <asp:LinkButton ID="lbtnEdit" runat="server" CommandName="Edit" Text="修改"></asp:LinkButton>&nbsp;
                                                <asp:LinkButton ID="lbtnDelete" runat="server" Text="删除" OnClientClick="return confirm('您确定要删除该项吗?');"
                                                    CommandName="Delete"></asp:LinkButton>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <tr>
                                            <td>
                                                <%# Eval("ID")%>
                                            </td>
                                            <td>
                                                <asp:DropDownList ID="drpParent" runat="server">
                                                </asp:DropDownList>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtEdiTitle" runat="server" Text='<%#Eval("Title")%>'></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:FileUpload ID="fulEditImg" runat="server" />
                                            </td>
                                            <td style="width: 130px">
                                                <asp:LinkButton ID="lbtnCancel" runat="server" Text="取消" CommandName="Cancel"></asp:LinkButton>&nbsp;
                                                <asp:LinkButton ID="lbtnUpdate" runat="server" Text="更新" CommandName="Update"></asp:LinkButton>
                                            </td>
                                        </tr>
                                    </EditItemTemplate>
                                    <EmptyDataTemplate>
                                        <tr>
                                            <td colspan="4">
                                                没有数据
                                            </td>
                                        </tr>
                                    </EmptyDataTemplate>
                                </asp:ListView>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <asp:HyperLink ID="lnkAdd" runat="server" Text="添加导航" ForeColor="Blue"></asp:HyperLink>
        <asp:Panel ID="pnlAddClient" runat="server" CssClass="addPnl" Width="100%">
            <h2>
                添加分类
            </h2>
            <p>
                请完成下面的内容:
            </p>
            <table cellspacing="1">
                <tr>
                    <th>
                        <span class="red">*</span>分类名称
                    </th>
                    <td>
                        <asp:TextBox ID="txtAddName" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvAddName" runat="server" Display="Static" ErrorMessage="请输入导航标题"
                            ControlToValidate="txtAddName" ValidationGroup="ClientAddGroup"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        图片logo
                    </th>
                    <td>
                        <asp:FileUpload ID="fulAddImg" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <asp:Button ID="btnSubmit" runat="server" Text="提交" ValidationGroup="ClientAddGroup"
                            OnClick="btnSubmit_Click" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <ajaxToolkit:PopupControlExtender ID="PopUpExtender" runat="server" TargetControlID="lnkAdd"
            PopupControlID="pnlAddClient" Position="Bottom">
        </ajaxToolkit:PopupControlExtender>
    </div>
</asp:Content>
